﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Pomodoro
{
    public partial class frmConfig : ConfigForm
    {
        public frmConfig()
        {
            InitializeComponent();
        }

        private void frmConfig_Load(object sender, EventArgs e)
        {
            LoadConfig();

            nAtomTime.Value = AtomTime;
            nShortBreakTime.Value = ShortBreakTime;
            nLongBreakTime.Value = LongBreakTime;
            nAtomsBeforeLongBreak.Value = AtomsBeforeLongBreak;
        }

        private void btnDefaults_Click(object sender, EventArgs e)
        {
            nAtomTime.Value = DEFAULT_ATOM_TIME;
            nShortBreakTime.Value = DEFAULT_SHORT_BREAK_TIME;
            nLongBreakTime.Value = DEFAULT_LONG_BREAK_TIME;
            nAtomsBeforeLongBreak.Value = DEFAULT_ATOMS_BEFORE_LONG_BREAK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            AtomTime = (int)nAtomTime.Value;
            ShortBreakTime = (int)nShortBreakTime.Value;
            LongBreakTime = (int)nLongBreakTime.Value;
            AtomsBeforeLongBreak = (int)nAtomsBeforeLongBreak.Value;

            SaveConfig();
        }
    }
}
